<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h="http://xmlns.jcp.org/jsf/html"
      xmlns:ui="http://xmlns.jcp.org/jsf/facelets">

    <h:head>
        <link rel="stylesheet" type="text/css" href="#{resource['css:styles.css']}" />
        <title>Agriculture For Sale</title>    
        <script>
            function scheduleAppointment() {
                if (#{farmUserController.signedIn})
                {
                    var time = prompt("Please enter a description of the time at which you wish to meet.", "(Please include date and time)");
                    return true;
                }
                else
                {
                    alert("Please sign in to schedule an appointment.");
                    return false;
                }
            }
            function init(data) {
                if (!data)
                    document.getElementById("addButton").style.display = "inline";
            }
        </script>
    </h:head>

    
    <ui:composition template="templates/content.xhtml">
        <ui:define name="content">
            <h:body onload="init(#{farmUserController.bean.currentProperty.isPurchased})">
                <h:form>
                    <h:outputText escape="false" value="#{farmUserController.bean.response}" /> <br/>

                    <h:commandButton id="apptmt" value="Schedule Appointment" onclick="scheduleAppointment();" action="#{farmUserController.schedAppointment('')}"/>
                    <h:commandButton value="Request More Info" action="#{farmUserController.requestMoreInfo()}" />
                    <span id="addButton" style="display: none"><h:commandButton id="addToCart" value="Add to Cart" action="#{farmUserController.addToCart()}"/></span>
                    <h:message id="abc" for="apptmt"/>
                </h:form>
                <br/>
                <h:form style="background-color: #888; border: solid black 1px; width: 100px; text-align: center">
                    <h:link value="Cart" outcome="UserCart"> (<h:outputText value="#{farmUserController.cartCount}" />)</h:link> <br/>
                </h:form>
            </h:body>
        </ui:define>
    </ui:composition>
</html>